package customerEnter.Frame.JDBCDao.UseQuery;

import java.util.ArrayList;
import java.util.List;

import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.jdbc.support.rowset.SqlRowSetMetaData;

import customerEnter.Frame.DaoDataTransmission.DaoFramePameTransmission;
import customerEnter.Frame.JDBCDao.Interface.DaoFrameUseTypeInterface;
import customerEnter.Frame.Utils.Log4j;

public class DaoFrameUseTypeListObjecsImpl implements DaoFrameUseTypeInterface<List<Object[]>> {

	public <T, K> List<Object[]> useDaoFrameDataType(DaoFramePameTransmission<T, K> daoFramePameTransmission) {
		List<Object[]> list = new ArrayList<Object[]>();
		SqlRowSet sqlRowSet = daoFramePameTransmission.sqlRowSet;
		SqlRowSetMetaData sqlRowSetMetaData = sqlRowSet.getMetaData();
		int in = sqlRowSetMetaData.getColumnCount();
		try {
			while (sqlRowSet.next()) {
				List<Object> list2 = new ArrayList<Object>();
				for (int i = 1; i <= in; i++) {
					list2.add(sqlRowSet.getObject(i));
				}
				list.add(list2.toArray());
			}
		} catch (Exception e) {
			Log4j.Log4JOutError("數據讀取出錯：" + e.getMessage());
		}
		return list;
	}
}
